package math.arithmetic.elementray.operation;

public class IntegerOperation extends AbstractOperation {
    protected int firstNumber;
    protected int secondNumber;

    public int getFirstNumber() {
        return firstNumber;
    }

    public void setFirstNumber(int firstNumber) {
        this.firstNumber = firstNumber;
    }

    public int getSecondNumber() {
        return secondNumber;
    }

    public void setSecondNumber(int secondNumber) {
        this.secondNumber = secondNumber;
    }

    @Override
    public String toString() {
        if (operator == 0) {
            return String.valueOf(result);
        }
        return String.valueOf(firstNumber) + operator + secondNumber;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        if (!super.equals(o))
            return false;

        IntegerOperation that = (IntegerOperation) o;

        if (firstNumber != that.firstNumber)
            return false;
        return secondNumber == that.secondNumber;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + firstNumber;
        result = 31 * result + secondNumber;
        return result;
    }
}